home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-18
/
bklbat.zip
/
BKLBAT.DOC
< prev
next >
Wrap
Text File
|
1992-02-04
|
14KB
|
330 lines
BKL.BAT
A Batch File Using LHA as a Backup Program
by Dan Goodell
February 4, 1991
THE PREMISE
This program came about from a desire for a cheap, quick, easy
to use, easy to customize backup program that doesn't clutter the
hard disk with massive, additional program files of its own, and
takes up minimal floppy disk space for its backups while using a
standard file compression method.
THE IDEA
This backup plan uses a minimum of floppy disk space for two
reasons. First, the backup files are compressed using the free
program LHA.EXE. If you don't already have that program, you'll
need to get it.
Second, backups are essentially "incremental" in nature -- not
performed on the entire hard disk, but only on those files that
have changed from a given program's original files since the time
that you installed it. For example, if you've installed a
wordprocessor, there's really no need to backup all the program
files the word-processor uses to run. You only need to backup
the program files that are customized for your use (such as a
configuration file of custom settings, or a supplemental spelling
dictionary), and of course the document files you create with the
wordprocessor. (Your custom program files are easy to spot --
just scan the program files in the directory for any files dated
on or after the date you installed that program.) If you ever
need to reinstall your wordprocessor from backups, first install
it using a copy of the original program, then use your backup
files to add or overlay the custom files.
BKL is designed around H. Yoshizaki's increasingly popular file
archiving and compression program, LHA, which is widely available
on BBS's without registration cost. BKL was originally written
around the file compression program PKZIP (if you use PKZIP, try
this original batch file - BK.BAT). However, PKZIP is shareware
with a registration cost. LHA is free. Also, with version 2.13
LHA is fast gaining on PKZIP in popularity. Accordingly, the
original BK.BAT file has been modified to work with LHA, version
2.13. It has not been tested and may not work with earlier
versions of LHA. Since LHA costs nothing and BKL costs nothing,
this backup method has zero cost, which certainly meets the
requirement that it be cheap.
It is quick because it doesn't backup everything. Backups are
split among several .LZH files and/or disks. Since some types of
files (e.g., batch files or configuration files) may change less
frequently than others (spreadsheets, wordprocessing documents,
etc.), they don't need backups as frequently. For example, you
could backup data files daily and batch files weekly or monthly.
Such selective backups can be done more often, in less time,
and with less disk swapping. BKL runs from the DOS command line
and avoids using a lot of switches or hard-to-remember codes.
This makes it easy to use.
Since BKL is a batch file, it's easy to modify with any text
editor. The list files are also ASCII text files, so modifying
them is easy when you want to change your backup list.
Lastly, since this backup program adds only one small batch
file, besides the LHA program itself, it doesn't take up much
disk space and doesn't add to the clutter of mystery files on
your hard disk. You will need to create some list files, but
those are maintained on the floppies with your backups, not on
your hard disk.
THE METHOD
You'll need to create one or more list files. A list file has
the extension .LST and is merely a list of the files you want to
backup together in the same .LZH (LHA's archive extension) file.
Save the .LST file on the same floppy disk that will hold that
backup archive.
To perform a backup, insert the backup disk and call BKL.BAT
with a command line parameter identifying which list you want to
use. BKL will call your copy of LHA.EXE and instruct it to look
for the appropriate .LST file on the floppy disk, compress and/or
update the files in that list, and save the compressed .LZH
archive on the floppy. BKL then updates the date and time stamp
of a directory entry with the extension .UPD on the floppy.
You can have any number of .LST files on your disk, subject to
available space, though remember that the program will add the
.LZH files and .UPD directory entries to the same disk. Here is
an example of a directory listing of a backup disk.
Directory of A:\
BATCH UPD 0 08-09-91 11:22a
CONFG UPD 0 08-09-91 11:25a
BATCH LST 49 11-06-90 9:57p
CONFG LST 404 12-08-90 4:49p
BATCH LZH 19420 08-09-91 11:22a
CONFG LZH 61944 06-17-91 12:05p
Issuing the command "BKL BATCH A:" at the DOS command line will
cause the BKL program to look on drive A: for the file BATCH.LST.
The file BATCH.LZH will be created or updated with the files you
specified in the BATCH.LST file. When BKL is finished updating
the .LZH file, it will update the BATCH.UPD directory entry with
the current date. Similarly, the command "BKL CONFG A:" would
update the CONFG.LZH file.
If preferred, you can keep the .LST files (or even the .UPD
files) on your hard disk; simply alter the BKL batch file
accordingly.
THE SETUP -- LIST FILES
Here is an example of a file list in a .LST file. The .LST
file is an ASCII text file consisting of a list of files that you
want included together in the same .LZH file. Note that DOS
wildcards can be used.
c:\dbase\config.db
c:\ato\*.dfn
c:\ato\*.ppn
c:\wp50\wp{wp}.set
c:\wp50\wp{wp}en.sup
c:\wp50\wpm\*.wpm
Use a text editor to create or modify your .LST files as
desired. For example, batch files could be grouped together, or
utility files, or databases, or your wordprocessing document
files, or as in the example above, it could be a group of seldom
changed setup or configuration files for a variety of programs.
Since some groups of files don't change as often as others, some
backups need not be done as often as others. You may want to run
a "data" backup daily but only need a "config" backup weekly.
Parameter names should be descriptive (BATCH, CONFG, UTIL, WP,
LOTUS, BANK, etc.) to make them easy to remember. The parameter
name is limited to no more than eight characters, and can include
only characters legal for DOS filenames. Add the extension
".LST" for a list file, and save it on your backup disk.
THE SETUP -- BKL.BAT
The program file BKL.BAT should be ready to run in most cases.
If necessary, it may be modified to accommodate your system.
As supplied, the batch file will backup to drives A: or B:,
which must be specified on the command line (there is no default
for the drive parameter). You can change the drives that you
will allow to be used for your backups by altering the lines
following the label ":start" in the BKL.BAT file. If you prefer,
you can also have the program use a default drive. For example,
to default to drive A: when no drive parameter is specified on
the command line, change the line:
"if %drv%!==! goto noparm"
to: "if %drv%!==! set drv=A:"
Following the ":pack" label, include the path to the directory
where your copy of LHA.EXE is, if necessary. The pathname is
optional if LHA.EXE will be accessible on your DOS path.
BKL makes use of another file, CHKDRV.COM, to bypass that
annoying "Abort, Retry, Fail..." message if you forget to put a
floppy in the drive. CHKDRV.COM is a slightly modified version
of DTEST.COM, published in PC/Computing Magazine's April 1991
issue. If you don't use CHKDRV.COM you will need to remove two
lines from BKL.BAT. If you do use it, include the path to it in
BKL.BAT if necessary.
MISCELLANEOUS DETAILS
BKL uses the DOS environment to store variables. If you do not
have enough environment space available, it may not run properly.
If you get an "Out of environment space" message, check your DOS
manual for instructions on increasing the size of your
environment space.
The .UPD entries are just directory entries; they don't use up
any disk space. Since the .LZH files should also contain the
date and time of the backup, the .UPD's may seem to be redundant.
However, if a backup is run but none of the files need updating,
the .LZH entry's date is not updated. Updating the .UPD entry in
these situations records the fact that your .LZH file is still
current as of the .UPD date, regardless of the date stamp on the
.LZH file. (Hint: sort your directories so the .UPD entries are
at the top so it's easier to see when the last backups were.)
Once files are compressed into the .LZH file, this program
updates only the files that have changed. It also stores the
full pathname (but not the drive). This means that a file can be
restored by moving to the root directory of the target drive and
using LHA's ability to recreate subdirectories, if desired.
Using the syntax "LHA x [archive] [file]" will extract the file
named [file] from the .LZH file named [archive]. The "x" option
will recreate the stored pathname in the current directory and
extract [file] to the subdirectory. Using the "e" option,
instead, will ignore the stored pathname and extract [file] to
the current directory.
BACKING UP MULTIPLE LISTS
If you wish to back up multiple lists at one time, simply write
a separate batch file with a series of "call bkl..." lines. Use
the optional parameter, "chain", to facilitate summarization of
errors. The "chain" parameter causes BKL to save the error
summary and chain it to the next call to BKL. To run multiple
backups at once, create a separate batch file similar to:
call bkl chain [list1] [d:]
call bkl chain [list2] [d:]
call bkl chain [list3] [d:]
...
call bkl chain [listY] [d:]
call bkl [listZ] [d:]
Leave the "chain" parameter off the last call. Upon finishing
the last call, BKL will display a summary of any errors occurring
on the earlier calls.
The above multi-run sample batch file requires DOS 3.3 or
later. Earlier DOS versions do not support the "call" command.
BKL works fine with earlier DOS versions, but without the "call"
command, BKL won't be able to summarize errors in a multiple-
backup run.
I have written an alternate version of BKL.BAT for multiple-
list use with DOS 3.2 or earlier. This version, BKL-ALT.BAT, has
the changes necessary to get a proper error summary at the end of
the last call. To do a multiple-list backup, create a separate
batch file as above, but change the "call bkl..." commands to
"command /c bkl-alt...". Include the path before the "command
/c..." if your copy of COMMAND.COM is not on your path.
DISCLAIMER
This is just a batch file. There are no fancy CPU tricks or
machine-specific commands. I make no warranties except that it
works for me. Basically, it is just a demonstration of how you
can use routine batch techniques to write your own backup program
around the popular LHA program. Therefore, it is not copyrighted
and does not cost you anything.
PKZIP is a trademark of PKWARE, Inc.
I'm interested in feedback or comments from anyone.
by Dan Goodell
1261 Hookston Road
Concord, CA 94518
CompuServe: 71520,3116
----------------end-of-author's-documentation---------------
Software Library Information:
This disk copy provided as a service of
Public (software) Library
We are not the authors of this program, nor are we associated
with the author in any way other than as a distributor of the
program in accordance with the author's terms of distribution.
Please direct shareware payments and specific questions about
this program to the author of the program, whose name appears
elsewhere in this documentation. If you have trouble getting
in touch with the author, we will do whatever we can to help
you with your questions. All programs have been tested and do
run. To report problems, please use the form that is in the
file PROBLEM.DOC on many of our disks or in other written for-
mat with screen printouts, if possible. PsL cannot debug pro-
programs over the telephone, though we can answer questions.
Disks in the PsL are updated monthly, so if you did not get
this disk directly from the PsL, you should be aware that the
files in this set may no longer be the current versions. Also,
if you got this disk from another vendor and are having prob-
lems, be aware that some files may have become corrupted or
lost by that vendor. Get a current, working disk from PsL.
For a copy of the latest monthly software library newsletter
and a list of the 4,000+ disks in the library, call or write
Public (software) Library
P.O.Box 35705 - F
Houston, TX 77235-5705
1-800-2424-PSL
MC/Visa/AmEx/Discover
Outside of U.S. or in Texas
or for general information,
Call 1-713-524-6394
PsL also has an outstanding
catalog for the Macintosh.